<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>支付宝支付测试页面</title>
    <!--bootstrap-->
    <link href="/shop-app/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="/shop-app/js/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="/shop-app/bootstrap/js/bootstrap.min.js"></script>
    <script src="/shop-app/js/CacheUtil.js"></script>
    <script src="/shop-app/js/HttpUtil.js"></script>
    <script src="/shop-app/js/OrdersUtils.js"></script>
    <script src="../js/UserCacheUtil.js"></script>
</head>
<body>
    <h3>支付宝支付</h3>



    <!--  订单页分状态导航栏  -->
    <nav class="navbar navbar-default col-xs-10 col-xs-offset-1">
        <div class="container ">
            <div>
                <form class="form-horizontal" action='${pageContext.request.contextPath}/shop-api/testPay'>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">订单编号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="oId" placeholder="订单编号">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">订单的总金额</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="oCount" placeholder="订单的总金额">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button  class="btn btn-default"  type="submit">在线支付</button>
                        </div>
                    </div>
                </form>
            </div>
        </div><!-- /.container-fluid -->
    </nav>



    <script>
        function aliPay() {
            //前端获取参数（1.订单编号 2.订单的总金额）
            let oId = $("#oId").val();
            let oCount = $("#oCount").val();

            console.log("从前端获取的订单编号：");
            console.log(oId);

            console.log("从前端获取的订单总金额：");
            console.log(oCount);

            //向后端发起Ajax请求
            $.ajax({
                url:"/shop-api/testPay",
                type:"post",
                data:oId,oCount
                // contentType: "application/json"
            })
            // document.write("<form action='${pageContext.request.contextPath }/shop-api/aliPay/pay' method=post name=manageDepForm style='display:none'>");
            // document.write("<input type=hidden name='oId' value='12345678'/>");//参数1
            // document.write("<input type=hidden name='oCount' value='888'/>");//参数2
            // document.write("</form>");
            // document.aliPay.submit();
        }
    </script>
</body>
</html>